#include"stdio.h" 
main()
{
	int a[5] = {3,5,4,2,1};
	int i,j,end,tmp;
	for(i=0;i<4;i++)
	{
		end = i;
		tmp = a[end+1];
		while(end>=0)
		{
			if(tmp>a[end])
			{
				a[end+1] = a[end];
				end--;
			}
			else
			break;
		}
		a[end+1] = tmp;
	}
		for(j=0;j<5;j++)
	{
		printf("%d ,",a[j]);
	}
	printf("\n");
}
/*main()
{
	int a[5] = {3,5,4,2,1};
	int i,j,end;
	for(i=1;i<5;i++)
	{
		int key;
		key = a[i];
		end = i-1;
		while(end>=0&&key<a[end])
		{			
			a[end+1] = a[end];
			end--;
		}
		a[end+1] = key;
	}
	for(j=0;j<5;j++)
	{
		printf("%d ,",a[j]);
	}
	printf("\n");
}*/
